import request from '@/utils/request'

// 获取员工列表
export const getEmployeeList = params => request.get('/sys/user', { params })

// 导出员工
export const exportEmployee = () => request({
  url: '/sys/user/export',
  responseType: 'blob'
})
// 导出员工
export const downloadEmployee = () => request({
  url: '/sys/user/import/template',
  responseType: 'blob'
})

// 导入员工
export const importEmployee = data => request.post('/sys/user/import', data)

// 新增员工
export const addEmployee = data => request.post('/sys/user', data)

// 获取员工数据
export const getEmployeeDetail = id => request.get(`/sys/user/${id}`)

// 修改员工
export const updateEmployee = data => request.put(`/sys/user/${data.id}`, data)

// 删除员工
export const delEmployee = id => request.delete(`/sys/user/${id}`)

// 获取可用的角色
export function getEnableRoleList() {
  return request({
    url: '/sys/role/list/enabled'
  })
}

// 分配角色
export function assignRole(data) {
  return request({
    url: '/sys/user/assignRoles',
    method: 'put',
    data
  })
}
